#ifndef _UTILITY_H_
#define _UTILITY_H_

// define the colData types
// Author: try
#define DATA_INT 1
#define DATA_CHAR 2
#define DATA_VCHAR 3



// define the definition of a col
// Authot: try
typedef struct col
{
	char name[256];
	int size;
	int type;
} col;
struct col* col_list;			//pointer to a col list
int         col_num;			//number of col

// define the input column value
// Author try
typedef struct colValue
{
        // NULL if isChar = 2 (=.=)
	short isChar;
	union 
	{
		int intValue;
		char charValue[256];
	} value;
} colValue;
struct colValue* value_list;	//pointer to a colValue list


typedef union descriptionUnion
{
	col ColDef;
	unsigned long numOfRecord;
} descriptionUnion;

//where begin

#define CON_AND 1
#define CON_OR 2

#define OP_EQ 1
#define OP_GT 2
#define OP_LT 3
#define OP_GE 4
#define OP_LE 5
#define OP_NE 6
#define OP_ISNIL 7

#define CT_OP_VAR 1
#define CT_OP_INT 2
#define CT_OP_STR 3

#define VALUE_TYPE_NULL 1
#define VALUE_TYPE_VAR  2
#define VALUE_TYPE_INT  3
#define VALUE_TYPE_STR  4


typedef struct whereCond
{
	int boolBefore;
	int conOp;	//and,or
	int op;	// > <  == >= <= !=

        int   lType;
	char* lTableName;
	char* lColName;
        char* lChar;
        int   lInt;

        int   rType;
	char* rTableName;
	char* rColName;
	char* rChar;
	int   rInt;
//	struct whereCond* nextCond;
} whereCond;

typedef struct whereLoc
{
	char* tableName;
	int fileid;
	int pageid;
	int rowid;
	struct whereLoc* nextLoc;
} whereLoc;

typedef struct whereRet
{
	whereLoc* locations;
	struct whereRet* nextRet;
} whereRet;

typedef struct fromTable
{
	char* tableName;
	struct fromTable* nextTable;
} fromTable;

//where end

#endif
